<template>
  <div class="car-list-item">
    <div class="chexkbox">
      <check-box :isClick="carD.check" @click.native="checkClick"></check-box>
    </div>
    <div class="item-img">
      <img :src="carD.image" alt="" />
    </div>

    <div class="item-context">
      <p class="context-title">{{ carD.title }}</p>
      <p class="context-desc">{{ carD.desc }}</p>
      <div class="context-clac">
        <div class="price">${{ carD.price }}</div>
        <div class="count">*{{ carD.count }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import CheckBox from "components/common/checkBox/CheckBox";

export default {
  components: { CheckBox },

  props: {
    carD: {
      type: Object,
      default() {
        return {};
      },
    },
  },

  methods: {
    checkClick() {
      console.log("我被点击");
      this.carD.check = !this.carD.check;
      this.$emit("handleCheckedItem");
    },
  },
};
</script>

<style scoped>
.car-list-item {
  /* height: 110px; */
  width: 100%;
  justify-content: space-between;
  display: flex;

  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
  background-color: yellow;
}

.chexkbox {
  text-align: center;
  margin-top: 40px;
  margin-right: 10px;
}
.item-img {
  width: 80px;
}
.item-img img {
  width: 80px;
  height: 100px;
  border-radius: 5px;
  object-fit: cover;
}
.item-context {
  flex: 1;
  width: 70%;
  padding-left: 15px;
}
.context-title {
  color: #333;
  font-size: 16px;
  padding-bottom: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.context-desc {
  color: #666;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-clac {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.price {
  color: #ff4500;
  font-size: 18px;
}
.count {
  font-size: 18px;
  color: #333333;
  padding-right: 10px;
}
</style>